package com.zhenyi;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.Resource;


/**
 * @author ：zhenyi
 * @date ：2020/7/15 0:27
 * @description：${description}
 */
public class Test {
	public static void main(String[] args) {
//		ApplicationContext app = new FileSystemXmlApplicationContext("D:\\IdeaProjects\\spring-framework-5.0.x\\zhenyiSpring\\src\\main\\resources\\application.xml");
		ApplicationContext app = new ClassPathXmlApplicationContext("application.xml");

//		AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(User.class);

		Student student = (Student) app.getBean("student");
		User user = (User) app.getBean("user");

//		Resource res = app.getResource("application.xml");
//		UserService userService = (UserService) app.getBean("userService");
		Object userService1 = app.getBean("&userService");
//		User zhangsan = userService.getUserByName("zhangsan");
		System.out.println(userService1);
//		System.out.println(zhangsan);

		System.out.println("properties="+System.getProperties());
		System.out.println("env="+System.getenv());
	}
}
